﻿using System.Collections.Generic;
using System.Net.Mail;
using Rodunu.Utilities.Email.Properties;

namespace Rodunu.Utilities.Email
{
    public class MessageFactory
    {
        public MailMessage BuildMessage(IEnumerable<string> toAddressList, string subject, string body)
        {
            MailMessage msg = new MailMessage
            {
                From = new MailAddress(Settings.Default.DefaultFromAddress),
                IsBodyHtml = true,
                Subject = subject,
                Body = body
            };

            foreach (string s in toAddressList)
            {
                msg.To.Add(s);
            }

            return msg;
        }

        public MailMessage BuildMessage(string toAddress, string subject, string body)
        {
            MailMessage msg = new MailMessage
            {
                From = new MailAddress(Settings.Default.DefaultFromAddress),
                IsBodyHtml = true,
                Subject = subject,
                Body = body
            };

            msg.To.Add(toAddress);
            return msg;
        }
    }
}
